package com.epic;

import com.google.inject.Guice;
import com.google.inject.Injector;

/**
 * https://www.tutorialspoint.com/guice/guice_quick_guide.htm
 * https://www.tutorialspoint.com/guice/guice_first_application.htm
 * 找到设计的技巧 也就是精髓
 */
public class GuiceTest {
    public static void main(String[] args) {
        Injector injector = Guice.createInjector(new TextEditorModule());
//        SpellChecker spellChecker = new SpellCheckerImpl();
//        injector.injectMembers(spellChecker);

        TextEditor editor = injector.getInstance(TextEditor.class);
        System.out.println(editor.getSpellCheckerId());
        editor.makeSpellCheck();

        TextEditor editor1 = injector.getInstance(TextEditor.class);
        System.out.println(editor1.getSpellCheckerId());

    }
}
